//
// Created by ZLY on 2025/5/11.
//

#ifndef AFFILIATEBAR_H
#define AFFILIATEBAR_H
#include "../core/object_affiliate.h"


class AffiliateBar : public ObjectAffiliate {
protected:
    float percentage_ = 1.0f;
    SDL_FColor color_high_ = {0, 1, 0, 1}; //绿色
    SDL_FColor color_mid_ = {1, 0.65, 0, 1}; //橙色
    SDL_FColor color_low_ = {1, 0, 0, 1}; //红色
public:
    static AffiliateBar *addAffiliateBarChild(ObjectScreen *parent, glm::vec2 size, glm::vec2 offset = glm::vec2(0),
                                              Anchor anchor = Anchor::CENTER);

    void render() override;

    void setPercentage(float percentage) {
        this->percentage_ = percentage;
    }

    void setHighColor(SDL_FColor highColor) {
        this->color_high_ = highColor;
    }

    void setMidColor(SDL_FColor midColor) {
        this->color_mid_ = midColor;
    }

    void setLowColor(SDL_FColor lowColor) {
        this->color_low_ = lowColor;
    }

    float getPercentage() {
        return this->percentage_;
    }

    SDL_FColor getHighColor() {
        return this->color_high_;
    }

    SDL_FColor getMidColor() {
        return this->color_mid_;
    }

    SDL_FColor getLowColor() {
        return this->color_low_;
    }
};


#endif //AFFILIATEBAR_H
